#ifndef PARTICLE_SYSTEM
#define PARTICLE_SYSTEM

#include "object.h"

class Vec3;
class Objet;

typedef struct
{
	Vec3 posInit;
	Vec3 speedInit;
	Vec3 pos;
	float age;
} PARTICLE ;

class ParticleSystem : public Objet
{
	public:
		ParticleSystem();
		ParticleSystem(int geom, int texid, Shader* s);
		void setParameters(int nbparts, float randomness, Vec3 vecEmit, float angle, float lifespan, Vec3 forces , bool sprites);
		void initialize();
		void draw();
		void animate(float dt);
		void reset();
		void emitParticle() ;
	private:
		bool m_emitting;
		bool m_useSprites;
		inline Vec3 generateVec();
		float m_randomness;
		Vec3 m_vecEmit;
		float m_angle;
		float m_lifespan;
		PARTICLE* m_particles;
		int m_nbparticles;
		Vec3 m_forces;
};

#endif
